home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / widget / nsIClipboardDragDropHooks.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  8KB  |  208 lines

  1. /*
  2.  * DO NOT EDIT.  THIS FILE IS GENERATED FROM nsIClipboardDragDropHooks.idl
  3.  */
  4.  
  5. #ifndef __gen_nsIClipboardDragDropHooks_h__
  6. #define __gen_nsIClipboardDragDropHooks_h__
  7.  
  8.  
  9. #ifndef __gen_nsISupports_h__
  10. #include "nsISupports.h"
  11. #endif
  12.  
  13. /* For IDL files that don't want to include root IDL files. */
  14. #ifndef NS_NO_VTABLE
  15. #define NS_NO_VTABLE
  16. #endif
  17. class nsITransferable; /* forward declaration */
  18.  
  19. class nsIDragSession; /* forward declaration */
  20.  
  21. class nsIDOMEvent; /* forward declaration */
  22.  
  23.  
  24. /* starting interface:    nsIClipboardDragDropHooks */
  25. #define NS_ICLIPBOARDDRAGDROPHOOKS_IID_STR "e03e6c5e-0d84-4c0b-8739-e6b8d51922de"
  26.  
  27. #define NS_ICLIPBOARDDRAGDROPHOOKS_IID \
  28.   {0xe03e6c5e, 0x0d84, 0x4c0b, \
  29.     { 0x87, 0x39, 0xe6, 0xb8, 0xd5, 0x19, 0x22, 0xde }}
  30.  
  31. /**
  32.  * Interfaces for overriding the built-in drag, drop, copy, and paste
  33.  * implementations in the content area and editors. Use this to do things
  34.  * such as prevent a drag from starting, adding or removing
  35.  * data and flavors, or preventing the drop.
  36.  *
  37.  * Embedders who want to have these hooks made available should implement
  38.  * nsIClipboardDragDropHooks and use the command manager to send the
  39.  * appropriate commands with these parameters/settings: 
  40.  *      command:  cmd_clipboardDragDropHook
  41.  *
  42.  *      params        value type   possible values
  43.  *      "addhook"     isupports    nsIClipboardDragDropHooks as nsISupports
  44.  *      "removehook"  isupports    nsIClipboardDragDropHooks as nsISupports
  45.  *
  46.  * Notes:
  47.  *  * Overrides/hooks need to be added to each window (as appropriate).
  48.  *    Adding them to the first window does not enable them for every window.
  49.  *  * If more than one implementation is set for a window, the hooks will be
  50.  *    called in the order they are added.
  51.  *  * Adding the same hook to the same window will not add a second call.
  52.  *    Each hook can only be called once per user action/api.
  53.  *  * Not all hooks are guaranteed to be called.  If there are multiple hooks
  54.  *    set for a window, any of them has an opportunity to cancel the action
  55.  *    so no further processing will occur.
  56.  *  * If any errors occur (without setting the boolean result) the default
  57.  *    action will occur.
  58.  *  * AllowDrop will be called MANY times during drag so ensure that it is
  59.  *    efficient. 
  60.  */
  61. class NS_NO_VTABLE nsIClipboardDragDropHooks : public nsISupports {
  62.  public: 
  63.  
  64.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICLIPBOARDDRAGDROPHOOKS_IID)
  65.  
  66.   /**
  67.    * Prevents the drag from starting
  68.    *
  69.    * @param event DOM event (drag gesture)
  70.    *
  71.    * @return TRUE  drag can proceed
  72.    * @return FALSE drag is cancelled, does not go to OS
  73.    */
  74.   /* boolean allowStartDrag (in nsIDOMEvent event); */
  75.   NS_IMETHOD AllowStartDrag(nsIDOMEvent *event, PRBool *_retval) = 0;
  76.  
  77.   /**
  78.    * Tells gecko whether a drop is allowed on this content area
  79.    *
  80.    * @param event   DOM event (drag over)
  81.    * @param session the drag session from which client can get
  82.    *                   the flavors present or the actual data
  83.    *
  84.    * @return TRUE  indicates to OS that if a drop does happen on this
  85.    *                browser, it will be accepted.
  86.    * @return FALSE indicates to OS drop is not allowed. On win32, this
  87.    *                will change the cursor to "reject".
  88.    */
  89.   /* boolean allowDrop (in nsIDOMEvent event, in nsIDragSession session); */
  90.   NS_IMETHOD AllowDrop(nsIDOMEvent *event, nsIDragSession *session, PRBool *_retval) = 0;
  91.  
  92.   /**
  93.    * Alter the flavors or data presented to the OS
  94.    * Used for drag and copy actions
  95.    * Because this can be called many times, it is highly recommended
  96.    * that the implementation be very efficient so user feedback is
  97.    * not negatively impacted.
  98.    *
  99.    * @param event  DOM event (drag drop); null if triggered by copy.
  100.    * @param trans  the transferable holding the list of flavors
  101.    *               and the data for each flavor
  102.    *
  103.    * @return TRUE  copy/drag can proceed
  104.    * @return FALSE copy/drag is cancelled, does not go to OS
  105.    */
  106.   /* boolean onCopyOrDrag (in nsIDOMEvent aEvent, in nsITransferable trans); */
  107.   NS_IMETHOD OnCopyOrDrag(nsIDOMEvent *aEvent, nsITransferable *trans, PRBool *_retval) = 0;
  108.  
  109.   /**
  110.    * Provide an alternative action to the built-in behavior when
  111.    * something is dropped on the browser or in an editor
  112.    *
  113.    * @param event  DOM event (drag drop); null if triggered by paste.
  114.    * @param trans  the transferable holding the list of flavors
  115.    *               and the data for each flavor
  116.    *
  117.    * @return TRUE  action was handled, do not perform built-in
  118.    *                behavior
  119.    * @return FALSE action was not overridden, do built-in behavior
  120.    */
  121.   /* boolean onPasteOrDrop (in nsIDOMEvent event, in nsITransferable trans); */
  122.   NS_IMETHOD OnPasteOrDrop(nsIDOMEvent *event, nsITransferable *trans, PRBool *_retval) = 0;
  123.  
  124. };
  125.  
  126. /* Use this macro when declaring classes that implement this interface. */
  127. #define NS_DECL_NSICLIPBOARDDRAGDROPHOOKS \
  128.   NS_IMETHOD AllowStartDrag(nsIDOMEvent *event, PRBool *_retval); \
  129.   NS_IMETHOD AllowDrop(nsIDOMEvent *event, nsIDragSession *session, PRBool *_retval); \
  130.   NS_IMETHOD OnCopyOrDrag(nsIDOMEvent *aEvent, nsITransferable *trans, PRBool *_retval); \
  131.   NS_IMETHOD OnPasteOrDrop(nsIDOMEvent *event, nsITransferable *trans, PRBool *_retval); 
  132.  
  133. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  134. #define NS_FORWARD_NSICLIPBOARDDRAGDROPHOOKS(_to) \
  135.   NS_IMETHOD AllowStartDrag(nsIDOMEvent *event, PRBool *_retval) { return _to AllowStartDrag(event, _retval); } \
  136.   NS_IMETHOD AllowDrop(nsIDOMEvent *event, nsIDragSession *session, PRBool *_retval) { return _to AllowDrop(event, session, _retval); } \
  137.   NS_IMETHOD OnCopyOrDrag(nsIDOMEvent *aEvent, nsITransferable *trans, PRBool *_retval) { return _to OnCopyOrDrag(aEvent, trans, _retval); } \
  138.   NS_IMETHOD OnPasteOrDrop(nsIDOMEvent *event, nsITransferable *trans, PRBool *_retval) { return _to OnPasteOrDrop(event, trans, _retval); } 
  139.  
  140. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  141. #define NS_FORWARD_SAFE_NSICLIPBOARDDRAGDROPHOOKS(_to) \
  142.   NS_IMETHOD AllowStartDrag(nsIDOMEvent *event, PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->AllowStartDrag(event, _retval); } \
  143.   NS_IMETHOD AllowDrop(nsIDOMEvent *event, nsIDragSession *session, PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->AllowDrop(event, session, _retval); } \
  144.   NS_IMETHOD OnCopyOrDrag(nsIDOMEvent *aEvent, nsITransferable *trans, PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->OnCopyOrDrag(aEvent, trans, _retval); } \
  145.   NS_IMETHOD OnPasteOrDrop(nsIDOMEvent *event, nsITransferable *trans, PRBool *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->OnPasteOrDrop(event, trans, _retval); } 
  146.  
  147. #if 0
  148. /* Use the code below as a template for the implementation class for this interface. */
  149.  
  150. /* Header file */
  151. class nsClipboardDragDropHooks : public nsIClipboardDragDropHooks
  152. {
  153. public:
  154.   NS_DECL_ISUPPORTS
  155.   NS_DECL_NSICLIPBOARDDRAGDROPHOOKS
  156.  
  157.   nsClipboardDragDropHooks();
  158.  
  159. private:
  160.   ~nsClipboardDragDropHooks();
  161.  
  162. protected:
  163.   /* additional members */
  164. };
  165.  
  166. /* Implementation file */
  167. NS_IMPL_ISUPPORTS1(nsClipboardDragDropHooks, nsIClipboardDragDropHooks)
  168.  
  169. nsClipboardDragDropHooks::nsClipboardDragDropHooks()
  170. {
  171.   /* member initializers and constructor code */
  172. }
  173.  
  174. nsClipboardDragDropHooks::~nsClipboardDragDropHooks()
  175. {
  176.   /* destructor code */
  177. }
  178.  
  179. /* boolean allowStartDrag (in nsIDOMEvent event); */
  180. NS_IMETHODIMP nsClipboardDragDropHooks::AllowStartDrag(nsIDOMEvent *event, PRBool *_retval)
  181. {
  182.     return NS_ERROR_NOT_IMPLEMENTED;
  183. }
  184.  
  185. /* boolean allowDrop (in nsIDOMEvent event, in nsIDragSession session); */
  186. NS_IMETHODIMP nsClipboardDragDropHooks::AllowDrop(nsIDOMEvent *event, nsIDragSession *session, PRBool *_retval)
  187. {
  188.     return NS_ERROR_NOT_IMPLEMENTED;
  189. }
  190.  
  191. /* boolean onCopyOrDrag (in nsIDOMEvent aEvent, in nsITransferable trans); */
  192. NS_IMETHODIMP nsClipboardDragDropHooks::OnCopyOrDrag(nsIDOMEvent *aEvent, nsITransferable *trans, PRBool *_retval)
  193. {
  194.     return NS_ERROR_NOT_IMPLEMENTED;
  195. }
  196.  
  197. /* boolean onPasteOrDrop (in nsIDOMEvent event, in nsITransferable trans); */
  198. NS_IMETHODIMP nsClipboardDragDropHooks::OnPasteOrDrop(nsIDOMEvent *event, nsITransferable *trans, PRBool *_retval)
  199. {
  200.     return NS_ERROR_NOT_IMPLEMENTED;
  201. }
  202.  
  203. /* End of implementation class template. */
  204. #endif
  205.  
  206.  
  207. #endif /* __gen_nsIClipboardDragDropHooks_h__ */
  208.